/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.tmd.controlefinanceiro.persistence;

import br.com.tmd.controlefinanceiro.modelo.Cliente;
import br.com.tmd.controlefinanceiro.modelo.Usuario;
import br.com.tmd.controlefinanceiro.util.HibernateUtil;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author luis
 */
public class ClienteDao extends GenericDao<Cliente>{

    public ClienteDao() {
        super(new Cliente());
    }
    
    public List<Cliente> listaClientes() {
       
        session = HibernateUtil.getSessionFactory().openSession();
        criteria = session.createCriteria(Cliente.class);
        //Criterion restricao = Restrictions.eq("tipo","C").ignoreCase();
        //criteria.add(restricao);
        criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
        List<Cliente> lista = criteria.list();
        session.close();
        return lista;
    }
}
